package com.micro.train.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.micro.train.entity.TrainMeal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 火车餐数据访问接口
 */
@Mapper
public interface TrainMealRepository extends BaseMapper<TrainMeal> {
    
    /**
     * 根据列车ID获取餐品列表
     */
    List<TrainMeal> selectByTrainId(@Param("trainId") Long trainId);
    
    /**
     * 根据餐品种类查询
     */
    List<TrainMeal> selectByMealType(@Param("mealType") String mealType);
    
    /**
     * 根据列车ID和餐品种类查询
     */
    List<TrainMeal> selectByTrainIdAndMealType(@Param("trainId") Long trainId, 
                                               @Param("mealType") String mealType);
    
    /**
     * 查询可用的餐品
     */
    List<TrainMeal> selectAvailableMeals(@Param("trainId") Long trainId);
    
    /**
     * 更新餐品库存
     */
    int updateStock(@Param("mealId") Long mealId, @Param("quantity") Integer quantity);
}
